//index.js
//获取应用实例
var app = getApp()
var commonURL = app.data.baseURL;
var commonURLYY = app.data.newURL;
const commonURLXX = app.data.XCX_PAY;
Page({
  data: {
    userInfo: {},
    sdata:true,
    isTz:false
  },
  onLoad: function () {
    var that=this;
    //调用应用实例的方法获取全局数据
    wx.request({
      url: commonURLXX + '&op=getUserInfo',
      data: { openid: app.data.openid || wx.getStorageSync('openid') },
      success: function (res) {
        console.log(res.data.msg)
        that.setData({
          userInfo: res.data.msg
        })
        wx.setStorageSync('userInfo', res.data.msg)
      }
    })
    
  },
  onShow:function(){
    var that=this;
    wx.request({//获取是否团长
      url: commonURL + 'op=is_area_commander',
      data: { "areaid": wx.getStorageSync('xiaoqu').item.id, "openid": wx.getStorageSync('openid'), "uniacid": app.data.GZHid },
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        console.log(res)
        if (res.data.status == 1) {
          that.setData({
            isTz: true
          })
        } else {
          that.setData({
            isTz: false
          })
        }
      }
    })
  }
})